from import_export.widgets import ForeignKeyWidget
from apps.pms.models import Version


class VersionForeignKeyWidget(ForeignKeyWidget):
    def get_queryset(self, value, row, *args, **kwargs):
        return Version.objects.filter(name=row['version'], product__name=row['product'])
